<template>
    <div class="navbar full text-left" style="line-height: 60px;padding-left: 20px">
      <el-button type="primary" @click="$bus.$emit('show-add-paper-dialog')">
        <i class="fa fa-plus"></i>&nbsp;创建试卷
      </el-button>
      <el-button type="danger" :disabled="selected" @click="$bus.$emit('delete-paper')">
        <i class="fa fa-remove"></i>&nbsp;删除
      </el-button>
    </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  name: 'Navbar',
  // data () {
  // },
  computed: {
    ...mapState(
      {
        selectedPapers: ({ paper }) => paper.selectedPapers
      }
    ),
    selected () {
      return this.selectedPapers.length === 0
    }
  }
}
</script>
